home *** CD-ROM | disk | FTP | other *** search
- class HighlightBoxout extends MovieClip
- {
- var __progress;
- var background;
- var __target;
- var __title;
- var __titleText;
- var __desc;
- var __bgWidth;
- var __bgHeight;
- var onRollOver;
- var boxoutBorder;
- var onRollOut;
- var onPress;
- var dispatchEvent;
- static var symbolName = "HighlightBoxout";
- static var symbolOwner = HighlightBoxout;
- var className = "HighlightBoxout";
- static var version = "0.0.0.1";
- function HighlightBoxout()
- {
- super();
- mx.events.EventDispatcher.initialize(this);
- }
- function init(Void)
- {
- this.__progress = new mx.controls.ProgressBar();
- this.__progress.label = "Highlight information will appear here";
- this.__progress.labelPlacement = "bottom";
- this.__progress.mode = "manual";
- super.init();
- }
- function size(Void)
- {
- super.size();
- }
- function get height()
- {
- return this.background._height;
- }
- function set target(tgt)
- {
- this.__target = tgt;
- }
- function set title(titleText)
- {
- trace("HighlightBoxout received title: " + titleText);
- this.__title = this.attachMovie("TextArea","title",3);
- this.__title.hScrollPolicy = this.__title.vScrollPolicy = "off";
- this.__title.label.selectable = this.__title.editable = this.__title.wordWrap = false;
- this.__title._x = 10;
- this.__title._y = 5;
- this.__title.setSize(340,32);
- this.__title.html = true;
- this.__title.setStyle("styleName","boxTitleStyle");
- this.__title.styleSheet = _global.textStyles;
- this.__title.embedFonts = true;
- this.__titleText = this.removeHTMLTags(titleText);
- this.__title.text = "<boxtitle>" + this.__titleText + "</boxtitle>";
- trace("TITLE HEIGHT: " + this.__title._height);
- }
- function set desc(descText)
- {
- this.__desc = this.attachMovie("TextArea","desc",5);
- this.__desc._x = 10;
- this.__desc._y = 36;
- this.__desc.setSize(340,85);
- this.__desc.html = true;
- this.__desc.hScrollPolicy = this.__desc.vScrollPolicy = "off";
- this.__desc.label.selectable = this.__desc.editable = false;
- this.__desc.wordWrap = true;
- this.__desc.embedFonts = true;
- this.__desc.setStyle("styleName","boxDescStyle");
- this.__desc.styleSheet = _global.textStyles;
- this.__desc.text = "<boxdesc>" + descText + "</boxdesc>";
- }
- function set styleSheet(css)
- {
- this.__title.styleSheet = this.__desc.styleSheet = css;
- }
- function set enabled(activeStatus)
- {
- if(activeStatus == true)
- {
- var _loc2_ = new TextFormat();
- _loc2_.color = 0;
- var _loc4_ = "<headline>" + this.__title.htmlText.slice(18,this.__title.htmlText.length - 19) + "</headline>";
- this.__title.setTextFormat(_loc2_);
- this.__title.setNewTextFormat(_loc2_);
- this.__title.htmlText = _loc4_;
- this.drawBackground(true,this.__bgWidth,this.__bgHeight);
- this.onRollOver = function()
- {
- this.__title.text = "<boxtitle><a class=\'underlined\'>" + this.__titleText + "</a></boxtitle>";
- var _loc2_ = new Color(this.boxoutBorder);
- _loc2_.setRGB("0x990000");
- };
- this.onRollOut = function()
- {
- this.__title.text = "<boxtitle>" + this.__titleText + "</boxtitle>";
- var _loc2_ = new Color(this.boxoutBorder);
- _loc2_.setRGB("0xCCC7B8");
- };
- this.onPress = function()
- {
- this.__title.text = "<boxtitle>" + this.__titleText + "</boxtitle>";
- var _loc2_ = new Color(this.boxoutBorder);
- _loc2_.setRGB("0xCCC7B8");
- this.sendMessage("Highlight pressed");
- };
- }
- else
- {
- _loc2_ = new TextFormat();
- _loc2_.color = 8421504;
- _loc4_ = "<headlinedisabled>" + this.__title.htmlText.slice(10,this.__title.htmlText.length - 11) + "</headlinedisabled>";
- this.__title.setTextFormat(_loc2_);
- this.__title.setNewTextFormat(_loc2_);
- this.__title.htmlText = _loc4_;
- this.drawBackground(false,this.__bgWidth,this.__bgHeight);
- this.onRollOver = this.onRollOut = this.onPress = null;
- }
- this.__desc.label.selectable = false;
- this.__title.enabled = this.__desc.enabled = activeStatus;
- }
- function drawBackground(enable, w, h)
- {
- trace("in drawBackground");
- trace(this);
- if(enable)
- {
- trace("enabled");
- var lightCol = 15591381;
- var darkCol = 13420472;
- }
- else
- {
- trace("disabled");
- var lightCol = 15658734;
- var darkCol = 14540253;
- }
- var borderWidth = 1;
- this.createEmptyMovieClip("background",1);
- with(this.background)
- {
- moveTo(borderWidth,0);
- beginFill(lightCol,100);
- lineTo(w - borderWidth,0);
- lineTo(w - borderWidth,h - borderWidth);
- lineTo(borderWidth,h - borderWidth);
- lineTo(borderWidth,borderWidth);
- endFill();
- }
- this.createEmptyMovieClip("boxoutBorder",2);
- with(this.boxoutBorder)
- {
- lineStyle(borderWidth,darkCol,40);
- moveTo(0,0);
- lineTo(w,0);
- lineTo(w,h);
- lineTo(0,h);
- lineTo(0,0);
- lineStyle(borderWidth,darkCol,100);
- moveTo(1,1);
- lineTo(w - 1,1);
- lineTo(w - 1,h - 1);
- lineTo(1,h - 1);
- lineTo(1,1);
- }
- }
- function setSize(w, h)
- {
- this.__bgHeight = h;
- this.__bgWidth = w;
- this.drawBackground(true,w,h);
- }
- function set image(imagePath)
- {
- }
- function removeHTMLTags(htmlText)
- {
- var _loc6_ = function(txt, index)
- {
- return txt.indexOf("<",index);
- };
- var _loc8_ = function(txt, index)
- {
- return txt.indexOf(">",index);
- };
- var _loc2_ = new Array();
- var _loc7_ = 0;
- var _loc9_ = undefined;
- var _loc10_ = undefined;
- while(_loc7_ < htmlText.length)
- {
- _loc9_ = _loc6_(htmlText,_loc7_);
- if(_loc9_ == -1)
- {
- break;
- }
- _loc10_ = _loc8_(htmlText,_loc9_);
- var _loc3_ = _loc6_(htmlText,_loc10_);
- while(_loc3_ == _loc10_ + 1)
- {
- _loc10_ = _loc8_(htmlText,_loc3_);
- _loc3_ = _loc6_(htmlText,_loc10_);
- }
- _loc2_.push({start:_loc9_,end:_loc10_});
- _loc7_ = _loc10_ + 1;
- }
- var _loc5_ = 0;
- while(_loc5_ < _loc2_.length)
- {
- _loc9_ = _loc2_[_loc5_].start;
- var _loc11_ = htmlText.charAt(_loc2_[_loc5_].start);
- _loc10_ = _loc2_[_loc5_].end;
- var _loc12_ = htmlText.charAt(_loc2_[_loc5_].end);
- var _loc16_ = htmlText.substring(_loc9_ + 1,_loc10_);
- _loc5_ = _loc5_ + 1;
- }
- if(_loc2_.length != 0)
- {
- var _loc18_ = "";
- if(_loc2_[0].start > 0)
- {
- _loc18_ += htmlText.substring(0,_loc2_[0].start);
- }
- var _loc4_ = 0;
- while(_loc4_ < _loc2_.length - 1)
- {
- var _loc13_ = _loc2_[_loc4_].end + 1;
- var _loc15_ = _loc2_[_loc4_ + 1].start;
- _loc18_ += htmlText.substring(_loc2_[_loc4_].end + 1,_loc2_[_loc4_ + 1].start);
- _loc4_ = _loc4_ + 1;
- }
- if(_loc2_[_loc2_.length - 1].end < htmlText.length - 1)
- {
- _loc18_ += htmlText.substring(_loc2_[_loc2_.length - 1].end + 1);
- }
- return _loc18_;
- }
- return htmlText;
- }
- function sendMessage(p_msgtxt)
- {
- this.dispatchEvent({target:this,type:"press",msgtxt:p_msgtxt});
- }
- }
-